package top.yaofengqiao.springcloudsimple.common.constant;

/**
 * @author yfq
 * @date 2024/6/19 9:22
 * @description
 */
public class MQConstant {
    private MQConstant() {
    }

    public static final String KEYS = "KEYS";
    public static final String SEPARATE = ":";

    // ========================订单相关========================

    // 分组名
    public static final String ORDER_GROUP = "ORDER_GROUP";

    // Topic
    // 普通消息
    public static final String ORDER_NORMAL_TOPIC = "ORDER_NORMAL_TOPIC";
    // 延时消息
    public static final String ORDER_DELAY_TOPIC = "ORDER_DELAY_TOPIC";
    // 事务消息
    public static final String ORDER_TRANSACTION_TOPIC = "ORDER_TRANSACTION_TOPIC";

    // Tag
    // 订单发货
    public static final String ORDER_DELIVER_TAG = "ORDER_DELIVER_TAG";
    // 订单支付
    public static final String ORDER_PAYMENT_TAG = "ORDER_PAYMENT_TAG";
    // 自动关单
    public static final String ORDER_CLOSE_TAG = "ORDER_CLOSE_TAG";
    // 订单支付超时时间
    public static final long ORDER_TIMEOUT = 60;

    public static String buildOrderNormalDestination(String tag) {
        return ORDER_NORMAL_TOPIC + SEPARATE + tag;
    }

    public static String buildOrderDelayDestination(String tag){
        return ORDER_DELAY_TOPIC + SEPARATE + tag;
    }

    public static String buildOrderTransactionDestination(String tag){
        return ORDER_TRANSACTION_TOPIC + SEPARATE + tag;
    }

}
